package com.chengxiaoxiao.ai_demo.config;

import cn.hutool.core.text.CharSequenceUtil;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * 文件存储配置
 *
 * @Description:
 * @Author Cheng Xiaoxiao
 * @Date: 2025/3/17 14:09
 */
@Data
@Component
@ConfigurationProperties(prefix = "px.file")
public class FileProperties {
    /**
     * 临时目录
     */
    private String savePath = "./upload";

    public String getSavePath() {
        Path normalize = Paths.get(savePath).toAbsolutePath().normalize();
        return CharSequenceUtil.appendIfMissing(normalize.toString(), "/");
    }
}
